<html>
<head><meta charset="utf-8"><title>What type to use for storing a Local&#x27;s value · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html">What type to use for storing a Local&#x27;s value</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220619034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220619034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220619034">(Dec 21 2020 at 19:12)</a>:</h4>
<p>Hellu all.</p>
<p>Today I'm starting to implement the dataflow pass for constant propagation, and it's been a while since I've worked on constprop. What MIR type should I use to store the constant propagated values? I'm indexing the values using <code>Local</code>, which I remember being the right approach, but I've forgotten how to best store these values.</p>
<p>More context: I will be keeping an <code>IndexVec</code> for each basic block, indexed with <code>Local</code>, and I'll be mutating the values stored in it as the algorithm looks for a fixpoint. I need whatever I have stored in the <code>IndexVec</code> to encode type information, to be very easy to read (since in each iteration I'll look most of them up at least once) and writable as well, since more than one iteration will end up mutating the values.</p>



<a name="220619764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220619764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220619764">(Dec 21 2020 at 19:20)</a>:</h4>
<p>(sorry if this is too obvious &gt;.&lt;; I'm just not sure of what container to use for this data)</p>



<a name="220621862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220621862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220621862">(Dec 21 2020 at 19:40)</a>:</h4>
<p>Are you using the dataflow framework in rustc? I think that takes care of storing the values for you.</p>



<a name="220621933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220621933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220621933">(Dec 21 2020 at 19:41)</a>:</h4>
<p>I am :3</p>



<a name="220622079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622079">(Dec 21 2020 at 19:42)</a>:</h4>
<p>Wait, really? That would be odd...</p>



<a name="220622099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622099">(Dec 21 2020 at 19:42)</a>:</h4>
<p>(though very nice)</p>



<a name="220622135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622135">(Dec 21 2020 at 19:42)</a>:</h4>
<p>Let's see, I'm looking right now at <code>dataflow/impls/init_locals.rs</code></p>



<a name="220622136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622136">(Dec 21 2020 at 19:42)</a>:</h4>
<p>Hmm I thought it did but it's been a while since I looked at it.</p>



<a name="220622158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622158">(Dec 21 2020 at 19:42)</a>:</h4>
<p>it's okay c:</p>



<a name="220622173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622173">(Dec 21 2020 at 19:43)</a>:</h4>
<p>init_locals stores a <code>BitSet</code></p>



<a name="220622199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622199">(Dec 21 2020 at 19:43)</a>:</h4>
<p><code>BitSet&lt;Local&gt;</code></p>



<a name="220622234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622234">(Dec 21 2020 at 19:43)</a>:</h4>
<p>One for every block, I think</p>



<a name="220622253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622253">(Dec 21 2020 at 19:43)</a>:</h4>
<p>(which may seem like a lot, but is actually fine for dataflow)</p>



<a name="220622338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622338">(Dec 21 2020 at 19:44)</a>:</h4>
<p>Every <code>BitSet</code> is initialized to <code>new_empty</code> (length: number of locals)</p>



<a name="220622403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622403">(Dec 21 2020 at 19:45)</a>:</h4>
<p><code>AnalysisDomain::Domain</code> is the type used by <code>ResultsCursor</code></p>



<a name="220622426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622426">(Dec 21 2020 at 19:45)</a>:</h4>
<p>So I believe that's the state of the dataflow analysis</p>



<a name="220622444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622444">(Dec 21 2020 at 19:45)</a>:</h4>
<p>yes</p>



<a name="220622467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622467">(Dec 21 2020 at 19:45)</a>:</h4>
<p>that's what I believe as well</p>



<a name="220622474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622474">(Dec 21 2020 at 19:45)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/dataflow/trait.AnalysisDomain.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/dataflow/trait.AnalysisDomain.html</a></p>



<a name="220622542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622542">(Dec 21 2020 at 19:46)</a>:</h4>
<p><code>JoinSemiLattice</code> is implemented for <code>IndexVec&lt;I, J&gt;</code></p>



<a name="220622573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622573">(Dec 21 2020 at 19:46)</a>:</h4>
<p>In the case of <code>init_locals.rs</code>, <code>Domain</code> is <code>BitSet&lt;Local&gt;</code> because it uses the <code>bool</code> lattice (where top and bottom are true and false respectively)</p>



<a name="220622609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622609">(Dec 21 2020 at 19:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125250">Wesley Wiser</span> <a href="#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local's.20value/near/220622542">said</a>:</p>
<blockquote>
<p><code>JoinSemiLattice</code> is implemented for <code>IndexVec&lt;I, J&gt;</code></p>
</blockquote>
<p>nice!</p>



<a name="220622631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622631">(Dec 21 2020 at 19:47)</a>:</h4>
<p>but what I need is that <code>J</code>, that's where I'm a bit lost</p>



<a name="220622647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622647">(Dec 21 2020 at 19:47)</a>:</h4>
<p>Gimme a sec</p>



<a name="220622654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622654">(Dec 21 2020 at 19:47)</a>:</h4>
<p>I'll show what I have</p>



<a name="220622666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622666">(Dec 21 2020 at 19:47)</a>:</h4>
<p>This is my <code>J</code></p>



<a name="220622677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622677">(Dec 21 2020 at 19:47)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">enum</span> <span class="nc">LatticeElem</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">U</span>: <span class="nb">Eq</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Bottom</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">Elem</span><span class="p">(</span><span class="n">U</span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="n">Top</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="220622760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622760">(Dec 21 2020 at 19:48)</a>:</h4>
<p>Ah gotcha</p>



<a name="220622776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622776">(Dec 21 2020 at 19:48)</a>:</h4>
<p>I'll be using the Constant Propagation Lattice, which is actually a different lattice for each type</p>



<a name="220622779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622779">(Dec 21 2020 at 19:48)</a>:</h4>
<p>Well that looks exactly like</p>



<a name="220622790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622790">(Dec 21 2020 at 19:48)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/dataflow/lattice/enum.FlatSet.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/dataflow/lattice/enum.FlatSet.html</a></p>



<a name="220622812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622812">(Dec 21 2020 at 19:48)</a>:</h4>
<p>Which impls <code>JoinSemiLattice</code> as well</p>



<a name="220622816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622816">(Dec 21 2020 at 19:48)</a>:</h4>
<p>That <code>U</code> is where I want to store the computed value of the locals</p>



<a name="220622848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622848">(Dec 21 2020 at 19:49)</a>:</h4>
<p>Ohhh, <code>FlatSet</code> looks real nice</p>



<a name="220622892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622892">(Dec 21 2020 at 19:49)</a>:</h4>
<p>Wait, they named the valued part <code>Elem</code> as well XD</p>



<a name="220622924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220622924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220622924">(Dec 21 2020 at 19:49)</a>:</h4>
<p>well, convergent evolution is at play I guess :D</p>



<a name="220623041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623041">(Dec 21 2020 at 19:50)</a>:</h4>
<p>Okay so I might be using <code>FlatSet</code>, or my equivalent if F.S. is limited in some way</p>



<a name="220623050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623050">(Dec 21 2020 at 19:50)</a>:</h4>
<p>but... what do I put as <code>T</code>?</p>



<a name="220623105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623105">(Dec 21 2020 at 19:51)</a>:</h4>
<p>If I was just propagating <code>i32</code>, I'd put <code>i32</code></p>



<a name="220623129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623129">(Dec 21 2020 at 19:51)</a>:</h4>
<p>But I need some way to encode the type and the value there</p>



<a name="220623216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623216">(Dec 21 2020 at 19:52)</a>:</h4>
<p>The hard part right now is not really in computing the <code>join</code>. That one's very easy for this lattice :3</p>



<a name="220623271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623271">(Dec 21 2020 at 19:52)</a>:</h4>
<p>Are you looking for <code>OpTy</code>?</p>



<a name="220623278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623278">(Dec 21 2020 at 19:52)</a>:</h4>
<p>I just need <code>T</code> (<code>U</code> in my case) to be <code>Eq</code></p>



<a name="220623296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623296">(Dec 21 2020 at 19:52)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/struct.OpTy.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/struct.OpTy.html</a></p>



<a name="220623309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623309">(Dec 21 2020 at 19:52)</a>:</h4>
<p>Thanks for the link!</p>



<a name="220623315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623315">(Dec 21 2020 at 19:52)</a>:</h4>
<p>Lemme check, one sec</p>



<a name="220623350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623350">(Dec 21 2020 at 19:53)</a>:</h4>
<p>That's how values are represented in miri and the current const prop pass</p>



<a name="220623395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623395">(Dec 21 2020 at 19:53)</a>:</h4>
<p>I see~</p>



<a name="220623438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623438">(Dec 21 2020 at 19:53)</a>:</h4>
<p>Okay, the type and layout info are bound to the <code>'tcx</code> lifetime, but that should be alright since those are constant</p>



<a name="220623519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623519">(Dec 21 2020 at 19:54)</a>:</h4>
<p>wait... the layout... yeah, that's constant as well right? A local can't change its layout, right?</p>



<a name="220623543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623543">(Dec 21 2020 at 19:54)</a>:</h4>
<p>I assume you were going to use miri to do the actual evaluation? I don't think we want another const eval engine in rustc lol</p>



<a name="220623562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623562">(Dec 21 2020 at 19:54)</a>:</h4>
<p>No, a local has a fixed layout</p>



<a name="220623570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623570">(Dec 21 2020 at 19:54)</a>:</h4>
<p>excellent</p>



<a name="220623587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623587">(Dec 21 2020 at 19:55)</a>:</h4>
<p>Yes, I plan to use miri XD</p>



<a name="220623601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623601">(Dec 21 2020 at 19:55)</a>:</h4>
<p>I'm not that mad yet</p>



<a name="220623654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623654">(Dec 21 2020 at 19:55)</a>:</h4>
<p>So I assume <code>OpTy</code> lets one evaluate it and operate on it, right?</p>



<a name="220623675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623675">(Dec 21 2020 at 19:55)</a>:</h4>
<p>Like, can I ask miri to add two <code>OpTy</code>?</p>



<a name="220623696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623696">(Dec 21 2020 at 19:56)</a>:</h4>
<p>(assuming addition is defined for their type and layout)</p>



<a name="220623761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623761">(Dec 21 2020 at 19:56)</a>:</h4>
<p>Yeah but basically to do so you need to create an instance of the evaluator and set it up for the body being run</p>



<a name="220623775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623775">(Dec 21 2020 at 19:56)</a>:</h4>
<p>I'd take a look at what the current pass does</p>



<a name="220623810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623810">(Dec 21 2020 at 19:56)</a>:</h4>
<p>Thank you Wesleeeeeeey TuT</p>



<a name="220623873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623873">(Dec 21 2020 at 19:57)</a>:</h4>
<p>What you're looking for starts around here <a href="https://github.com/rust-lang/rust/blob/11c94a197726b6a981828cb1837d7c3eed1b841d/compiler/rustc_mir/src/transform/const_prop.rs#L370">https://github.com/rust-lang/rust/blob/11c94a197726b6a981828cb1837d7c3eed1b841d/compiler/rustc_mir/src/transform/const_prop.rs#L370</a></p>



<a name="220623879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623879">(Dec 21 2020 at 19:57)</a>:</h4>
<p>and then continues to the end of the function</p>



<a name="220623885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623885">(Dec 21 2020 at 19:57)</a>:</h4>
<p>You're very welcome!</p>



<a name="220623972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623972">(Dec 21 2020 at 19:58)</a>:</h4>
<p>You might want to make <code>ConstPropMachine</code> pub and re-use it</p>



<a name="220623984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220623984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220623984">(Dec 21 2020 at 19:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125250">Wesley Wiser</span> <a href="#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local's.20value/near/220623761">said</a>:</p>
<blockquote>
<p>Yeah but basically to do so you need to create an instance of the evaluator and set it up for the body being run</p>
</blockquote>
<p>This should be fine, if the evaluator doesn't need to keep state or anything that would make it invalid to reuse across many propagations at different basic blocks :3</p>



<a name="220624191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624191">(Dec 21 2020 at 20:00)</a>:</h4>
<p>Oh boi yes, that <code>ConstPropMachine</code> uses some macros that I'd prefer to not need to read right now. I reckon I should re-use it for now and then after all of this is done, make it so the machine lives inside the new dataflow-based implementation's file :3</p>



<a name="220624441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624441">(Dec 21 2020 at 20:03)</a>:</h4>
<p>Okay, I think this is all I needed to go a long way for now. Thank you again Wesley <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="220624446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624446">(Dec 21 2020 at 20:03)</a>:</h4>
<p>Hmm ... iirc I think it would be possible to move the current statement pointer around and get it to do what you want</p>



<a name="220624466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624466">(Dec 21 2020 at 20:03)</a>:</h4>
<p>I'm not totally sure so take what I said with a huge grain of salt lol</p>



<a name="220624468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624468">(Dec 21 2020 at 20:03)</a>:</h4>
<p>statement pointer?</p>



<a name="220624545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624545">(Dec 21 2020 at 20:04)</a>:</h4>
<p>It takes a <code>Body</code> and then runs over the statements in it so it knows what the next statement to eval is</p>



<a name="220624547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624547">(Dec 21 2020 at 20:04)</a>:</h4>
<p>what is a statement pointer in this context? This is the first time I read the phrase :o</p>



<a name="220624553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624553">(Dec 21 2020 at 20:04)</a>:</h4>
<p>oh</p>



<a name="220624562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624562">(Dec 21 2020 at 20:04)</a>:</h4>
<p>It's just an index into the statement vec</p>



<a name="220624572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624572">(Dec 21 2020 at 20:04)</a>:</h4>
<p>I see!</p>



<a name="220624576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624576">(Dec 21 2020 at 20:04)</a>:</h4>
<p>But I believe you can mutate where it points</p>



<a name="220624582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624582">(Dec 21 2020 at 20:04)</a>:</h4>
<p>Cool</p>



<a name="220624598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624598">(Dec 21 2020 at 20:04)</a>:</h4>
<p>You will probably need to overwrite what values it has for locals though</p>



<a name="220624634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624634">(Dec 21 2020 at 20:05)</a>:</h4>
<p>Since the dataflow pass will iterate over the same statement multiple times as it gets to a fixedpoint</p>



<a name="220624646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624646">(Dec 21 2020 at 20:05)</a>:</h4>
<p>yep</p>



<a name="220624720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220624720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220624720">(Dec 21 2020 at 20:06)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/struct.InterpCx.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/struct.InterpCx.html</a> is the main thing you're going to be dealing with in terms of miri</p>



<a name="220625022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220625022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220625022">(Dec 21 2020 at 20:09)</a>:</h4>
<p>oh wow that's a big API</p>



<a name="220625064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220625064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220625064">(Dec 21 2020 at 20:09)</a>:</h4>
<p>I'm seeing there some fns to evaluate operations, I think</p>



<a name="220625091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220625091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220625091">(Dec 21 2020 at 20:09)</a>:</h4>
<p>That should be pretty close to what is needed for the transfer functions</p>



<a name="220625230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220625230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220625230">(Dec 21 2020 at 20:11)</a>:</h4>
<p>Yeah, if you want to see how different operations are normally handled, I'd recommend starting with the <code>statement()</code> function and then tracing the call hierarchy from there <a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_mir/interpret/step.rs.html#79-141">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_mir/interpret/step.rs.html#79-141</a></p>



<a name="220639021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220639021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220639021">(Dec 21 2020 at 22:36)</a>:</h4>
<p>How can I check if a <code>Local</code> is a constant?</p>
<p>I was thinking of using <code>InterpCx::eval_operand</code> <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/struct.InterpCx.html#method.eval_operand">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/struct.InterpCx.html#method.eval_operand</a> and then checking if the <code>Operand</code> inside the <code>OpTy</code> that's given as a result is initialized. So either an <code>Operand::Indirect</code> or an <code>Operand::Immediate</code> whose <code>Scalars</code> are not of the <code>Uninitialized</code> variant</p>



<a name="220639052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220639052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220639052">(Dec 21 2020 at 22:37)</a>:</h4>
<p>But that seems too convoluted to me</p>



<a name="220639071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220639071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220639071">(Dec 21 2020 at 22:37)</a>:</h4>
<p>I must be missing some canonical way to do it <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="220652415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220652415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220652415">(Dec 22 2020 at 02:13)</a>:</h4>
<p>Well what I really need to do is to seed the initial block with the values that are known at the beginning of the analysis</p>



<a name="220652462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220652462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220652462">(Dec 22 2020 at 02:14)</a>:</h4>
<p>Be it by asking if a <code>Local</code> is a constant or by doing something else, doesn't really matter</p>



<a name="220688382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220688382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220688382">(Dec 22 2020 at 13:26)</a>:</h4>
<p>I'm not quite sure what you mean. Are you talking about code like:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">u32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">y</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>and wanting to know if <code>x</code> and <code>y</code> are constant values or do you mean after dataflow runs or something?</p>



<a name="220692461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220692461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220692461">(Dec 22 2020 at 14:10)</a>:</h4>
<p>I mean sort of that code, but more like knowing that in here:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">const</span><span class="w"> </span><span class="n">FIVE</span>: <span class="kt">u32</span> <span class="o">=</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">u32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">y</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p><code>FIVE</code>'s value is 5. Or are <code>const</code> not <code>Local</code>s for the block? In which case, I think the state of the initial block can be left as-is</p>



<a name="220692661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220692661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220692661">(Dec 22 2020 at 14:12)</a>:</h4>
<p>Because, yeah, the value of <code>x</code> and <code>y</code>are assigned inside the block, so the facts that <code>x = 4</code> and <code>y = 2</code> will be picked up during the dataflow process</p>



<a name="220692680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220692680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220692680">(Dec 22 2020 at 14:12)</a>:</h4>
<p><code>FIVE</code> will be stored in a temporary local when you use it in most cases.</p>



<a name="220692718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220692718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220692718">(Dec 22 2020 at 14:13)</a>:</h4>
<p>It may also directly be used as <code>Operand::Constant</code>.</p>



<a name="220693060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220693060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220693060">(Dec 22 2020 at 14:16)</a>:</h4>
<p>Oh, you're completely right. Look, it even gets propagated to <code>z</code> here: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=1f8bf0a26412ed46a90c7a35ca30a2f7">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=1f8bf0a26412ed46a90c7a35ca30a2f7</a></p>



<a name="220693081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220693081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220693081">(Dec 22 2020 at 14:16)</a>:</h4>
<p>Although I wonder if that's a consequence of old constprop</p>



<a name="220693094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220693094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220693094">(Dec 22 2020 at 14:17)</a>:</h4>
<p>x'D</p>



<a name="220693243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/What%20type%20to%20use%20for%20storing%20a%20Local%27s%20value/near/220693243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/What.20type.20to.20use.20for.20storing.20a.20Local&#x27;s.20value.html#220693243">(Dec 22 2020 at 14:19)</a>:</h4>
<p>Hmm, well, if it does indeed get stored in a temporary local, then that's all that's needed to use it in the dataflow steps</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>